jQuery(document).on("pageinit", "[data-role='page']", function(){
    var switch_info = {
        "home": {
            "prev": ABOUT_URL,
            "next": NEARBY_CATEGORIES_URL
        },
        "nearby": {
            "prev": HOME_URL,
            "next": PROFILE_URL
        },
        "profile":{
            "prev": NEARBY_CATEGORIES_URL,
            "next": SEARCH_URL
        },
        "search": {
            "prev": PROFILE_URL,
            "next": ABOUT_URL
        },
        "about": {
            "prev": SEARCH_URL,
            "next": HOME_URL
        }
    };

    var page = jQuery(this);
    var pagetype = page.jqmData("pagetype");
    page.on("swiperight", function(event){
        if(switch_info[pagetype]){
            jQuery(":mobile-pagecontainer").pagecontainer("change", switch_info[pagetype].prev);
        }
    });
    page.on("swipeleft", function(event){
        if(switch_info[pagetype]){
            jQuery(":mobile-pagecontainer").pagecontainer("change", switch_info[pagetype].next);
        }
    });
});

